#ifndef _TPMS_MSG_H_
#define _TPMS_MSG_H_

#include "def.h"

	typedef struct sTpmsInfo
	{	
		u8 t_Pressure;//胎压值
		u8 t_Temperature;//温度值
		u8 t_p_high_value;//高压值
		u8 t_p_low_value;//低压值
		u8 t_T_high_value;//高温报警值
		u8 t_Linking;//配对
		u8 alarm;

		u8 t_low_leak:1;  //慢速漏气
		u8 t_fast_leak:1; //快速漏气
		u8 t_low_bat:1;	//电池电量
		u8 t_high_temp:1; //轮胎温度过高
		u8 t_high_p:1;//轮胎过压
		u8 t_low_p:1;	//轮胎欠压
		u8 res:1;//保留位
		u8 t_invalid:1;//传感器失效

	}sTPMSINFO,*psTPMSINFO;

enum enumSetTPMSAlarmStatus{
enumSetTPMSAlarmInit,
enumSetTPMSAlarmHighPre,
enumSetTPMSAlarmLowPre,
enumSetTPMSAlarmHighTemp,
enumSetTPMSAlarmMax};
	
	
	typedef struct _TPMS_MSG_INFO{
		sTPMSINFO CarTireS[4];
		sTPMSINFO LastCarTireS[4];
		u8 TpmsExist;
		U32 sendRandomNumber;
		BOOL haveExtTpms;
		U32 lastRecPingTime;
		BOOL bRefreshTpms;
		
		U8 clearTireAlarm;
		U32 clearTireAlarmTimer;
		U8 clearTireAlarmCount;
		
		BOOL bHaveTpmsAlarm;		
		U8   tpmsAlarmCount;	
		
		enum enumSetTPMSAlarmStatus eSetTPMSAlarmStatus;
		
	}TPMS_MSG_INFO;

	#ifndef		_TPMS_MSG_GLOBAL_
		#define		TPMS_MSG_GLOBAL		extern

	#else
		#define		TPMS_MSG_GLOBAL	
		//局部申明:.........		
	#endif


TPMS_MSG_GLOBAL TPMS_MSG_INFO TPMSMsgInfo;
		
		
TPMS_MSG_GLOBAL void dealTPMSAlarmMsg(U8 whichTire);		
TPMS_MSG_GLOBAL void TPMSMsgDataProc(U8 data);		
TPMS_MSG_GLOBAL void TPMSFreeIdleProc(void);
TPMS_MSG_GLOBAL void TPMSMsgInit(void);
	

#endif
